package com.yz.lzq.liwushuo.ui.modules.home.boutique.gridview.christmas;

import com.yz.lzq.liwushuo.config.NumberUtil;
import com.yz.lzq.liwushuo.http.OnGetNetDataListener;
import com.yz.lzq.liwushuo.jsonbean.home.boutique.christmas.ChristmasBean;

/**
 * Created by Administrator on 2016/12/21.
 */

public class ChristmasPrisenter {
    private ChristmasContract.ChristmasModelInterface modelInterface = null;
    private ChristmasContract.ChristmasViewInterface viewInterface = null;
    private int mOffSet;

    public ChristmasPrisenter(ChristmasContract.ChristmasViewInterface viewInterface) {
        this.viewInterface = viewInterface;
        modelInterface = new ChristmasModel();
    }

    /**
     * 请求数据展示RecyclerView视图
     */
    public void showRecycleView(final boolean loadMore) {

        if (loadMore) {
            mOffSet += 20;
        } else {
            mOffSet = 0;
        }
        modelInterface.getNetWorkData(NumberUtil.LIMIT, mOffSet, viewInterface.getUrlID(), new OnGetNetDataListener<ChristmasBean>() {
            @Override
            public void onGetDataSucess(ChristmasBean data) {
                viewInterface.getRecyclerViewBean(data);
            }

            @Override
            public void onGetDataFalied(Throwable t) {

            }
        }, loadMore);
    }
}
